SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 56448: An incorrect query might be passed to DB2 if you use the SASTRACE= system option and batch submitting in a z/OS operating environment

DetailsHotfixAboutRate It

When you run a z/OS batch job that includes an SQL query, incorrect syntax might be passed to DB2. The problem occurs if the SQL query references a DB2 table via the LIBNAME engine. The DB2 error that results from the incorrect code might vary, but the following are some of the known errors:

DB2: Entering db2m_prep()
DB2: Entering db2m_error() with SQLCODE -182
DB2: DB2M_SQLCA->sqlcode: -182

DB2 ERROR:
RESULT OF SQL STATEMENT:
DSN00182E AN ARITHMETIC EXPRESSION WITH A DATETIME VALUE IS INVALID
A DUMP OF THE SQLCA FOR THE GET DIAGNOSTICS REQUEST FOLLOWS:
          ROW NUMBER: 0 ERROR CONDITION: 1 REASON CODE: 0
DB2: Entering db2m_prep()
DB2: Entering db2m_error() with SQLCODE -122
DB2: DB2M_SQLCA->sqlcode: -122

DB2 ERROR:
RESULT OF SQL STATEMENT:
DSN00122E COLUMN OR EXPRESSION IN THE SELECT LIST IS NOT VALID
A DUMP OF THE SQLCA FOR THE GET DIAGNOSTICS REQUEST FOLLOWS:
          ROW NUMBER: 0 ERROR CONDITION: 1 REASON CODE: 0
          SQLCODE: -122 SQLSTATE: 42803 SQLERRP: DSNXOGB

The incorrect code that is built depends on how many times you run a query and what the system option SASTRACE= is set to. The first error occurred when FOR FETCH was added to the end of the query instead of FOR FETCH ONLY. The second one occurred when the code COALESCE(MAX(ID), 0) was passed as COALESCE(MAX(TXT_1."ID"), 0 SECONDS).

To work around this issue, either omit the SASTRACE= system option or else run the job interactively.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS/ACCESS Interface to DB2z/OS9.3 TS1M29.4 TS1M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.